# Copyright 2021 Ant Group Co., Ltd.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#   http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

load("//bazel:yacl.bzl", "yacl_cc_binary", "yacl_cc_library", "yacl_cc_test")

package(default_visibility = ["//visibility:public"])

yacl_cc_library(
    name = "common",
    hdrs = ["common.h"],
    deps = [
        "//yacl/crypto/rand",
        "//yacl/link",
        "//yacl/utils:serialize",
    ],
)

yacl_cc_library(
    name = "prg",
    srcs = ["prg.cc"],
    hdrs = ["prg.h"],
    deps = [
        "//yacl:secparam",
        "//yacl/base:dynamic_bitset",
        "//yacl/crypto/block_cipher:symmetric_crypto",
    ],
)

yacl_cc_test(
    name = "prg_test",
    srcs = ["prg_test.cc"],
    deps = [
        ":prg",
    ],
)

yacl_cc_library(
    name = "ro",
    hdrs = ["ro.h"],
    deps = [
        "//yacl/crypto/hash:hash_utils",
    ],
)

yacl_cc_test(
    name = "ro_test",
    srcs = ["ro_test.cc"],
    deps = [
        ":ro",
        "//yacl/crypto/rand",
    ],
)

yacl_cc_library(
    name = "rp",
    srcs = ["rp.cc"],
    hdrs = ["rp.h"],
    deps = [
        "//yacl/crypto/block_cipher:symmetric_crypto",
    ],
)

yacl_cc_test(
    name = "rp_test",
    srcs = ["rp_test.cc"],
    deps = [
        ":prg",
        ":rp",
        "//yacl/crypto/rand",
    ],
)

yacl_cc_library(
    name = "crhash",
    srcs = ["crhash.cc"],
    hdrs = ["crhash.h"],
    deps = [
        ":rp",
        "//yacl/crypto/aes:aes_intrinsics",
        "//yacl/crypto/rand",
    ],
)

yacl_cc_test(
    name = "crhash_test",
    srcs = ["crhash_test.cc"],
    deps = [
        ":crhash",
        ":prg",
    ],
)

yacl_cc_binary(
    name = "benchmark",
    srcs = [
        "benchmark.cc",
        "benchmark.h",
    ],
    deps = [
        ":crhash",
        ":prg",
        ":ro",
        ":rp",
        "//yacl/base:aligned_vector",
        "//yacl/crypto/rand",
        "@com_github_google_benchmark//:benchmark_main",
    ],
)
